package db

import "github.com/go-xorm/xorm"

/**
* 数据源管理器
* author changlin.guo
 */
type IDbSourceManager interface {

	//通过名称获取数据源
	GetDbSource(name string) *xorm.Engine

	AddDbSource(name string) *xorm.Engine
}

//单例模式
var dbSourceManager IDbSourceManager

//获取数据源管理器
func DbSourceManager() IDbSourceManager {
	return dbSourceManager
}

//依赖注入
func InjectDbSourceManager(_datasourceManager IDbSourceManager) {
	dbSourceManager = _datasourceManager
}
